/**
 * Created by zhangzhihao on 2016/12/06 11:00;
 */
var vm = new Vue({
    el: '#main',
    data: {
       	userDatas : {},
		pagination: [],
		queryData:{
			nowPage:1,
			rowNum:10,
			object:{}
		},
		pageNum:null,
		deleteDatas:{
			datas:[]
		},
		optTypes:[]
    },
    created: function () {
        this.queryTask();
        $("#titleText").text("1--征得投被保人同意");
        setTimeout(function(){
        	$('#optStatus').on('change', function() {
                vm.queryData.object.taskState = $(this).val();
            });
        }, 1);
    },
    methods: {
        selectPage:function(page){
            this.queryData.nowPage = page;
            this.queryTask();
        },
        offsetPage:function(offset){
            this.queryData.nowPage = this.queryData.nowPage + offset;
            this.queryTask();
        },
        queryTask:function(reset){ 	
        	this.queryData.object.startTime = $("#txtBeginDay").val() ;
        	this.queryData.object.endTime = $("#txtEndDay").val();
        	if(reset){
				this.queryData.nowPage = 1;
			}
        	App.ajax({
    			type:"POST",
    			url:App.getApiUrl("queryTaskURL"),
    			data:this.queryData,
    			success:function(data){
    				vm.userDatas = data;

                    vm.queryData.nowPage = vm.userDatas.nowPage;
                    vm.queryData.allPages = vm.userDatas.allPages;
                    vm.pagination = getPagination(vm.queryData.nowPage,vm.queryData.allPages);
				}
			});
        },
        
		
        //重置按钮
        resetBtn:function(){
            window.location.reload();
        },
        
        gotoPage:function(url,taskId){
            window.location.href = App.getBaseUrl() + url + "?taskId=" + taskId;
        }
    }
});

function rowNumChange(value){
    vm.queryData.rowNum = value;
    vm.queryData.nowPage = 1;
    vm.queryTask();
}